Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ACS-6668] [ACS-6669] e2e migration - Info Drawer general and library properties tests #3628

Merged
merged 22 commits into from
Feb 13, 2024

Conversation

katarzynakita
Copy link
Contributor

@katarzynakita katarzynakita commented Feb 2, 2024

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (check one with "x")

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation
  • Other... Please describe: migrating tests

What is the new behaviour?
Migrated e2e infoDrawer - files: general and library properties tests from Protractor to Playwright

Does this PR introduce a breaking change? (check one with "x")

  • Yes
  • No

@CLAassistant
Copy link

CLAassistant commented Feb 2, 2024

CLA assistant check
All committers have signed the CLA.

@katarzynakita katarzynakita force-pushed the ACS-6668-infoDrawer-general branch 2 times, most recently from a35800a to dac5bff Compare February 9, 2024 09:13
@katarzynakita katarzynakita force-pushed the ACS-6668-infoDrawer-general branch from b9d3488 to 592ca07 Compare February 11, 2024 21:15
@katarzynakita katarzynakita changed the title [DRAFT] Acs 6668 info drawer general [ACS-6668] [ACS-6669] e2e migration - Info Drawer general and library properties tests Feb 11, 2024
@katarzynakita katarzynakita marked this pull request as ready for review February 11, 2024 21:29
import { ApiClientFactory, Utils, test, SitesApi, QueriesApi, SITE_VISIBILITY, SITE_ROLES } from '@alfresco/playwright-shared';

test.describe('Library properties', () => {
let sitesApi: SitesApi;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sitesApi, username, user2, user3 and site are duplicated in describe for "non manager" - can we reuse instead of duplicating?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved it accordingly, user2 and user3 were not needed on the top

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please let me know if I need to fix the sitesApi too (because I'm not sure how)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@katarzynakita I was thinking about something more or less like that structure. Thanks that all these variables like sitesApi, username, user2, user3, site etc. are not duplicated and beforeEach have less duplicated code too. You can also check if rest of code like afterEach etc. won't be possible too to write like that.

But basically in that solution you have one main describe with whole common code and two different describes for each part of e2es like "non manager" and "manager" describes.

test.describe('Library properties', () => {
  let sitesApi: SitesApi;
  let apiClientFactory: ApiClientFactory;

  const username = `user1-${Utils.random()}`;
  const site = {
    name: `site1-${Utils.random()}`,
    id: `site-id-${Utils.random()}`,
    visibility: SITE_VISIBILITY.MODERATED,
    description: 'my site description'
  };

  test.beforeAll(async () => {
    apiClientFactory = new ApiClientFactory();
    await apiClientFactory.setUpAcaBackend('admin');
    await apiClientFactory.createUser({ username });
    sitesApi = await SitesApi.initialize(username, username);
    await sitesApi.createSite(site.name, site.visibility, site.description, site.id);
  });

  test.describe('Manager', () => {
    const siteForUpdate = {
      name: `site2-${Utils.random()}`,
      id: `site-id-${Utils.random()}`,
      visibility: SITE_VISIBILITY.MODERATED,
      description: 'my initial description'
    };
    const siteDup = `site3-${Utils.random()}`;

    test.beforeAll(async () => {
      try {
        await sitesApi.createSite(siteForUpdate.name, siteForUpdate.visibility, siteForUpdate.description, siteForUpdate.id);
        await sitesApi.createSite(siteDup);
      } catch (error) {
        console.error(`beforeAll failed: ${error}`);
      }
    });
  });

  test.describe('Non manager', () => {
    const user2 = `user2-${Utils.random()}`;
    const user3 = `user3-${Utils.random()}`;

    test.beforeAll(async () => {
      try {
        await apiClientFactory.createUser({ username: user2 });
        await apiClientFactory.createUser({ username: user3 });
        await sitesApi.addSiteMember(site.id, user2, SITE_ROLES.SITE_COLLABORATOR.ROLE);
        await sitesApi.addSiteMember(site.id, user3, SITE_ROLES.SITE_MANAGER.ROLE);
      } catch (error) {
        console.error(`beforeAll failed: ${error}`);
      }
    });
  });
});

@katarzynakita katarzynakita force-pushed the ACS-6668-infoDrawer-general branch from da7cad5 to 18f572c Compare February 12, 2024 23:52
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@katarzynakita katarzynakita merged commit 1400545 into develop Feb 13, 2024
27 checks passed
@katarzynakita katarzynakita deleted the ACS-6668-infoDrawer-general branch February 13, 2024 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants